{include file="header"}
<div style="padding: 20px;" class="adminmyucms">
<form class="layui-form" action="">
<table class="layui-table">
  <colgroup>
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>名称</th>
      <th>经验大于</th>
      <th>会员组图标</th>
      <th>会员组权限</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    <tr>
      <td><input type="text" name="title" value=""  placeholder="例如初级会员" autocomplete="off" lay-verify="required" class="layui-input"></td>
      <td><input type="text" name="dayu" value=""  placeholder="请输入" autocomplete="off"  lay-verify="required"  class="layui-input"></td>
      <td><input type="text" name="ico" value=""  lay-verify="required"  placeholder="请输入" autocomplete="off"  class="layui-input"></td>
      <td>
      <input type="checkbox" name="qx[1]" value="1" title="发送消息">
      <input type="checkbox" name="qx[2]" value="2" title="发表评论">
      <input type="checkbox" name="qx[3]" value="3" title="发表内容">
      <input type="checkbox" name="qx[4]" value="4" title="投稿免审">
      <input type="checkbox" name="qx[5]" value="5" title="免付费">
      </td>
      <td><button class="layui-btn layui-btn-warm" lay-submit lay-filter="set-add">添加会员组</button></td>
    </tr>
  </tbody>
</table>
</form>
<hr style="padding:10px; background-color: #fff">
{volist name="html" id="vo"}
<form class="layui-form" action="">
<input type="hidden" name="id" value="{$vo.id}">	
<table class="layui-table">
  <thead>
    <tr>
      <th>ID</th>
      <th>会员组名</th>
      <th>经验大于</th>
      <th>图标地址</th>
      <th>权限</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    <tr  class="layui-form">
      <th>{$vo.id}</th>
      <th><input type="text" name="title" value="{$vo.title}" autocomplete="off" lay-verify="required" class="layui-input"></th>
      <th><input type="text" name="dayu" value="{$vo.dayu}" autocomplete="off" lay-verify="required" class="layui-input"></th>
      <th><input type="text" name="ico" value="{$vo.ico}" autocomplete="off" lay-verify="required" class="layui-input"></th>
      <th>
      <input type="checkbox" name="qx[1]" value="1" title="发送消息"  {if condition="socha($vo['qx'],1) eq '1'"}checked{/if}>
      <input type="checkbox" name="qx[2]" value="2" title="发表评论"  {if condition="socha($vo['qx'],2) eq '1'"}checked{/if}>
      <input type="checkbox" name="qx[3]" value="3" title="发表内容"  {if condition="socha($vo['qx'],3) eq '1'"}checked{/if}>
      <input type="checkbox" name="qx[4]" value="4" title="投稿免审"  {if condition="socha($vo['qx'],4) eq '1'"}checked{/if}>
      <input type="checkbox" name="qx[5]" value="5" title="免付费"  {if condition="socha($vo['qx'],5) eq '1'"}checked{/if}>
      </th>
      <th>
      	<div class="layui-btn-group" id="admin_set">
      		<button class="layui-btn layui-btn-sm layui-btn-normal" style="float: left;" lay-submit lay-filter="set"><i class="layui-icon">&#xe9aa;</i> 更新</button>
      		 <a  member-name="确定要删除这条记录吗?" url="{:url("set/delete")}?id={$vo.id}&m=memberZu" lay-submit lay-filter="delete"  class="layui-btn layui-btn-danger layui-btn-sm"> <i class="layui-icon">&#xe640;</i>删除</a>
        </div>
      </th>
    </tr>
  </tbody>
</table>
</form>
{/volist} 
<div class="pages">
{$html->render()}
<div>
</div> 
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //更新
  form.on('submit(set)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("member/updatezu")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          //location.href = '{:url("index/index")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
  //添加
  form.on('submit(set-add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("member/insertzu")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
})
layui.use('laydate', function(){
  var laydate = layui.laydate;
  laydate.render({
    elem: '#time'
  });
});
</script>
{include file="footer"}